﻿using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace XRM.Security.DataAccess.Models
{
    [Table("UserInfoSystem")]
    public class UserInfoSystem
    {
        [Key]
        [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
        public int UserInfoSystemId { get; set; }

        public int UserRegisterId { get; set; }
        public int InfoSystemId { get; set; }

        public DateTime GrantDate { get; set; }
        public int GrantSystemUserId { get; set; }
        public DateTime? RevokeDate { get; set; }
        public int? RevokeSystemUserId { get; set; }
        public string RevokeReason { get; set; }

        [ForeignKey("UserRegisterId")]
        public virtual UserRegister UserRegister { get; set; }
        [ForeignKey("InfoSystemId")]
        public virtual InfoSystem InfoSystem { get; set; }

        [ForeignKey("GrantSystemUserId")]
        public virtual SystemUser GrantSystemUser { get; set; }
        [ForeignKey("RevokeSystemUserId")]
        public virtual SystemUser RevokeSystemUser { get; set; }
    } 
}
